package Singleton_Pattern.Mysql;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class sql {
    private volatile static sql instance=null;

    private List sql_List=null;

    private sql(){
        sql_List=new ArrayList();
    }

    public static sql getInstance(){
        if(instance==null){
            synchronized (sql.class){
                if (instance==null){
                    instance=new sql();
                }
            }
        }
        return instance;
    }
    public void add_sql(String sql){
        sql_List.add(sql);
    }
    public String getSql(){
        Random random=new Random();
        int i =random.nextInt(sql_List.size());
        return (String)sql_List.get(i);
    }
}
